package com.karson.front.controller;

import com.karson.common.request.PageParamRequest;
import com.karson.common.response.AlbumResponse;
import com.karson.common.response.CommonResult;
import com.karson.common.vo.PageVo;
import com.karson.service.service.RecommendService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ZKS
 */
@RestController
@RequestMapping("/api/recommend")
@Tag(name = "推荐接口")
public class RecommendController {
    @Autowired
    private RecommendService recommendService;
    @Operation(summary = "时间维度榜")
    @GetMapping("/hot/{period}")
    public CommonResult<PageVo<AlbumResponse>> getHotRecommendList(@PathVariable String period, @ModelAttribute @ParameterObject PageParamRequest pageParamRequest) {
        PageVo<AlbumResponse> albumResponses = recommendService.getHotRecommendList(period,pageParamRequest);
        return CommonResult.success(albumResponses);
    }
    @Operation(summary = "全站热门推荐榜")
    @GetMapping("/hot/all")
    public CommonResult<PageVo<AlbumResponse>> getHotRecommendListAll(@ModelAttribute @ParameterObject PageParamRequest pageParamRequest) {
        PageVo<AlbumResponse> albumResponses = recommendService.getAllHotRank(pageParamRequest);
        return CommonResult.success(albumResponses);
    }
    @Operation(summary = "获取用户个性化推荐列表")
    @GetMapping("/interest/list")
    public CommonResult<PageVo<AlbumResponse>> getInterestList(@ModelAttribute @ParameterObject PageParamRequest pageParamRequest) {
        PageVo<AlbumResponse> albumResponses = recommendService.getInterestList(pageParamRequest);
        return CommonResult.success(albumResponses);
    }
    @Operation(summary = "云梦眠荐列表拉取")
    @GetMapping("/interest/mein")
    public CommonResult<List<AlbumResponse>> getInterestListMein(@RequestParam(required = false) List<Integer> ids) {
        List<AlbumResponse> albumResponses = recommendService.getInterestWithDistinct(ids);
        return CommonResult.success(albumResponses);
    }
}
